﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Routing;
using System.Text;
using System.IO;


namespace Htss.Platform.Web
{
    /// <summary>
    /// 视图辅助类
    /// </summary>
    public class HtmlHelper
    {
        public Dictionary<string,Data.DbTable> ViewDbTable
        {
            get;
            set;
        }
        public ViewDataDictionary ViewData
        {
            get;
            set;
        }
        public ViewDataDictionary VerificationMessage
        {
            get;
            set;
        }
        public RequestContext RequestContext
        {
            get;
            set;
        }
        public HttpRequestBase Request
        {
            get;
            set;
        }
        public HttpSessionStateBase Session
        {
            get;
            set;
        }
        public HttpResponseBase Response
        {
            get;
            set;
        }

        public object Action(string NameSpace,string BoxName)
        {
            using (StringWriter sw = new StringWriter())
            {
                try
                {
                    ChildAction.ActionHelper(RequestContext, BoxName, NameSpace, sw);
                }
                catch (HttpException e)
                {
                    RequestContext.HttpContext.Response.Write(e.Message);
                }
                return sw.ToString();
            }
        }
    }
}
